//对称二叉树
class Solution5 {
    public boolean isSymmetric(TreeNode root) {
        if(root == null){
            return true;
        }
        return isSymmetricchild(root.left,root.right);
    }
    public boolean isSymmetricchild(TreeNode leftTree,TreeNode rightTree){
        if((leftTree != null && rightTree == null) || (leftTree == null && rightTree != null)){
            return false;
        }
        if(leftTree == null && rightTree == null){
            return true;
        }
        if(leftTree.val != rightTree.val){
            return false;
        }

        return isSymmetricchild(leftTree.left,rightTree.right)&&
        isSymmetricchild(leftTree.right,rightTree.left);

    }
}